package com.peng.wx_official_account.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peng.wx_official_account.entity.pojo.Copywriting;
import com.peng.wx_official_account.mapper.CopywritingMapper;
import com.peng.wx_official_account.service.CopywritingService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

@Service
@SuppressWarnings({"unused", "SpellCheckingInspection"})
public class CopywritingServiceImpl extends ServiceImpl<CopywritingMapper, Copywriting> implements CopywritingService {

    @Override
    public String getOneOfCopywritingList() {
        List<Copywriting> list = this.lambdaQuery().list();
        return list.size() == 0 ? null : list.get(new Random().nextInt(list.size())).getContent();
    }
}
